/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package extension.game.poker;

import java.util.List;
import log.Debug;

/**
 *
 * @author daz
 */
public class PokerConversion {
//h:heart
//d:diamond
//s:spade
//c:clubs

    public static String getRoundName(int round) {
        switch (round) {
            case PokerGame.PRE_FLOP:
                return "PRE_FLOP";
            case PokerGame.FLOP:
                return "FLOP";
            case PokerGame.RIVER:
                return "RIVER";
            case PokerGame.SHOW_DOWN:
                return "SHOW_DOWN";
            case PokerGame.TURN:
                return "TURN";
            default:
                return "UNDEFINED";
        }
    }

    public static String getBetActionName(int action) {
        switch (action) {
            case PokerGame.FOLD:
                return " FOLD";
            case PokerGame.BET:
                return " BET";
            case PokerGame.CALL:
                return " CALL";
            case PokerGame.CHECK:
                return " CHECK";
            case PokerGame.RAISE:
                return " RAISE";
            default:
                return " UNDEFINED";
        }
    }

    public static String getHandName(int hand) {
        switch (hand) {
            case PokerGame.FOUR_OF_KIND:
                return "FOUR_OF_KIND";
            case PokerGame.FULL_HOUSE:
                return "FULL HOUSE";
            case PokerGame.HIGH_CARD:
                return "HIGH_CARD";
            case PokerGame.ONE_PAIR:
                return "ONE_PAIR";
            case PokerGame.ROYAL_FLUSH:
                return "ROYAL_FLUSH";
            case PokerGame.STRAIGHT:
                return "STRAIGHT";
            case PokerGame.STRAIGHT_FLUSH:
                return "STRAIGHT_FLUSH";
            case PokerGame.THREE_OF_KIND:
                return "THREE_OF_KIND";
            case PokerGame.TWO_PAIR:
                return "TWO_PAIR";
            case PokerGame.FLUSH:
                return "FLUSH";
            default:
                return "";

        }
    }

    public static String getCardName(int cardId) {
        String suit = "";
        switch (cardId / 13) {
            case 0:
                suit = " (h)";
                break;
            case 1:
                suit = " (d)";
                break;
            case 2:
                suit = " (c)";
                break;
            case 3:
                suit = " (s)";
                break;
        }
        if (cardId % 13 == 0) {
            return "A" + suit;
        }
        if (cardId % 13 <= 9) {
            return ((cardId % 13) + 1) + suit;
        } else {
            switch (cardId % 13) {
                case 10:
                    return "J" + suit;
                case 11:
                    return "Q" + suit;
                default:
                    return "K" + suit;
            }
        }

    }

    public static void main(String[] args) {
        Debug.console(getCardName(10));
    }

    public static String getCardList(List<Integer> cardList) {
        if (cardList == null) {
            return "";
        }
        StringBuilder builder = new StringBuilder();
        for (Integer i : cardList) {
            builder.append(getCardName(i)).append("-");
        }
        return builder.toString();
    }
}
